module TransportesHelper
	
	def instacia_grid
     result = "<script type='text/javascript'>"
		result << "var xg = Ext.grid;"
	 result << "</script>"
	end
	
	def fields_faturamentosdia_extjs
		result = "<script type='text/javascript'>"
			result << "var fields_faturamentosdia_extjs = ["
			Deposito.all.each do |d|
				result  << "{name: '#{d.nome.downcase}'},"
			end
			result  << "{name: 'data'},"
			result  << "{name: 'total'}]"
		result << "</script>"
	end
	
	def columns_faturamentosdia_extjs
		result = "<script type='text/javascript'>"
			result << "var columns_faturamentosdia_extjs =  new xg.ColumnModel(["
			result << "new xg.RowNumberer()"
			result  << ",{header: 'DATA', sortable: true, dataIndex: 'data'}"
			Deposito.all.each do |d|
				result  << ",{header: '#{d.nome.upcase_br}', sortable: true, dataIndex: '#{d.nome.downcase}'}"
			end						
			result  << ",{header: 'TOTAL', sortable: true, dataIndex: 'total'}"			
			result  << "])"
		result << "</script>"
	end	
	
	def fields_faturamentosmes_extjs
		fields_faturamentosdia_extjs
	end
	
	def columns_faturamentosmes_extjs
		columns_faturamentosdia_extjs
	end		
	
end
